package mi.payment.controller;

import android.content.Context;
import android.content.res.Resources;

import mi.payment.MyApplication;
import mi.payment.ui.base.ParentActivity;
import mi.payment.utils.MToast;

public abstract class BaseController {

    public ParentActivity activity;

    public Context mContext;
    public ParentActivity mActivity;

    public BaseController(ParentActivity activity) {
        this.activity = activity;
        this.mContext = activity;
        this.mActivity = activity;
    }

    public ParentActivity getActivity() {
        return activity;
    }

    public void showToast(int resId) {
        MToast.showToast(resId);
    }

    public static void showToast(int resId, int duration) {
        MToast.showToast(resId, duration);
    }

    public void showToast(String msg) {
        MToast.showToast(msg);
    }

    public static void showToast(final String msg, int duration) {
        MToast.showToast(msg, duration);
    }

    public String getString(int resId) {
        return MyApplication.app.getResources().getString(resId);
    }

    public String getString(int resId, Object... formatArgs) {
        return MyApplication.app.getResources().getString(resId, formatArgs);
    }

    public int getColor(int id) {
        return MyApplication.app.getResources().getColor(id);
    }

    public Resources getResources() {
        return MyApplication.app.getResources();
    }

}
